﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using COM.OA.Entity;
using COM.OA.BLL;

public partial class linminchao_xw_updateNews : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        users loginuser = Session["loginuser"] as users;
        if (loginuser == null)
        {
            this.Response.Write(string.Format(GetRedirect.ALLREDIRECT, "../../login.aspx"));
        }
        else
        {
        if (!IsPostBack)
        {
            int id = Int32.Parse(this.Request.QueryString["newsid"]);
            news ss = newsBLL.Select(id);
            this.zhuti.Value = ss.n_title;
            this.FreeTextBox1.Text = ss.n_content;
        }
        }
    }
    protected void submit1_Click(object sender, EventArgs e)
    {
        int id = Int32.Parse(this.Request.QueryString["newsid"]);
        news ss = newsBLL.Select(id);
        string bt = this.zhuti.Value;
        string nr = this.FreeTextBox1.Text;
        ss.n_title = bt;
        ss.n_content = nr;
        int ii = newsBLL.Update(ss);
        if (ii < 0)
        {
            Response.Write(string.Format(GetRedirect.WINALERT, "修改成功！"));
            Response.Write(string.Format(GetRedirect.REDIRECT, "xw_lookOneNews.aspx?newsid="+id));
        }
        else
        {
            Response.Write(string.Format(GetRedirect.WINALERT, "修改失败！"));
        }
    }
}
